Page({
  data: {
    navLeftItems: [
      {id: 1, name: '纯色系列', desc: '描述'},
      {id: 2, name: '跳色系列', desc: '描述'},
      {id: 3, name: '渐变色系列', desc: '描述'},
    ],
    navRightItems: [
      {id: 1, child: [
        {name: 'one', imgsrc: '/images/pure/p_1.jpg', id:'one_1'},
        { name: 'two', imgsrc: '/images/pure/p_2.jpg', id:'one_2'},
        { name: 'three', imgsrc: '/images/pure/p_3.jpg', id:'one_3'},
        { name: 'three', imgsrc: '/images/pure/p_4.jpg', id:'one_4'},
        { name: 'three', imgsrc: '/images/pure/p_5.jpg', id:'one_5'},
        { name: 'three', imgsrc: '/images/pure/p_6.jpg', id:'one_6'},
        { name: 'three', imgsrc: '/images/pure/p_7.jpg', id:'one_7'},
        { name: 'three', imgsrc: '/images/pure/p_8.jpg', id:'one_8'},
      ]},

      {
        id: 2, child: [
          { name: 'one', imgsrc: '/images/skip/s_1.jpg', id: 'one_1' },
          { name: 'two', imgsrc: '/images/skip/s_2.jpg', id: 'one_2' },
          { name: 'three', imgsrc: '/images/skip/s_3.jpg', id: 'one_3' },
          { name: 'three', imgsrc: '/images/skip/s_4.jpg', id: 'one_4' },
          { name: 'three', imgsrc: '/images/skip/s_5.jpg', id: 'one_5' },
          { name: 'three', imgsrc: '/images/skip/s_6.jpg', id: 'one_6' },
          { name: 'three', imgsrc: '/images/skip/s_7.jpg', id: 'one_7' },
          { name: 'three', imgsrc: '/images/skip/s_8.jpg', id: 'one_8' },
        ]
      },
      {
        id: 3, child: [
          { name: 'one', imgsrc: '/images/gradient/g_1.jpg', id: 'one_1' },
          { name: 'two', imgsrc: '/images/gradient/g_2.jpg', id: 'one_2' },
          { name: 'three', imgsrc: '/images/gradient/g_3.jpg', id: 'one_3' },
          { name: 'three', imgsrc: '/images/gradient/g_4.jpg', id: 'one_4' },
          { name: 'three', imgsrc: '/images/gradient/g_5.jpg', id: 'one_5' },
          { name: 'three', imgsrc: '/images/gradient/g_6.jpg', id: 'one_6' },
          { name: 'three', imgsrc: '/images/gradient/g_7.jpg', id: 'one_7' },
          { name: 'three', imgsrc: '/images/gradient/g_8.jpg', id: 'one_8' }
        ]
      },
    ],
    curNav: 1,
    curIndex: 0,
    //  modal 
    hiddenmodalput: true,
    title: '',
    modalimgsrc: ''
  },
  onLoad: function () {
    // 加载的使用进行网络访问，把需要的数据设置到data数据对象
    
  },

  //事件处理函数
  switchRightTab: function (e) {
    // 获取item项的id，和数组的下标值
    let id = e.target.dataset.id,
      index = parseInt(e.target.dataset.index);
    // 把点击到的某一项，设为当前index
    this.setData({
      curNav: id,
      curIndex: index
    })
  },
  // 绑定事件
  tapEvent: function(e){
    var item = e.currentTarget.dataset.item;

    var imgsrc = item.imgsrc;
    var title = item.id;
    console.log(title)

    this.setData({
      hiddenmodalput: false,
      title: title,
      modalimgsrc: imgsrc
    })
    
  },
  // 弹框确定事件
  confirm: function(){
    this.setData({
      hiddenmodalput: true,
      title: '',
      modalimgsrc: ''
    })
  },

  // 弹框取消事件
  cancel: function(){
    this.setData({
      hiddenmodalput: true,
      title: '',
      modalimgsrc: ''
    })
  }

})
